package com.novel.frame.lxf;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;

import com.novel.db.BaseDao;
import com.novel.frame.lgw.Notice;
import com.novel.frame.lgw.StackRoom;
import com.novel.frame.wxl.RankingFrame;
import com.novel.frame.wxl.WelfareFrame;
import com.novel.frame.yf.My_bookshelf;


/**
 * 小说框架
 */
public class Register_Jpanel extends JFrame {

	private JScrollPane sp_center;// 总滚动面板

	private JPanel pl_ALL;// 总面板

	/*
	 * 上部固定面板
	 */
	private JPanel pl_north;// 上部固定面板

	private JPanel pl_north_north;// 上部固定面板上部
	private JLabel lb_BookSeaGirlNet;// 书海女生网按钮
	private JLabel lb_BookSeaGirlNetPart;// 书海女生网按钮隔开线
	private JLabel lb_BookSeaLiteratureNet;// 书海文学网按钮
	private JLabel lb_BookSeaLiteratureNetPart;// 书海文学网按钮隔开线
	private JLabel lb_BookSeaComicNet;// 书海动漫网按钮
	private JLabel lb_register;// 注册按钮
	private JLabel lb_registerPart;// 注册按钮隔开线
	private JLabel lb_help;// 帮助按钮
	private JLabel lb_helpPart;// 帮助按钮隔开线
	private JLabel lb_north_login;// 登录按钮
	private JLabel lb_north_loginPart;// 登录按钮隔开线
	private JLabel lb_Client;// 客户端按钮

	private JPanel pl_north_center;// 上部固定面板中部
	private JLabel lb_BooksSea;// 书海标签
	private JLabel lb_HotSearch;// 热搜标签
	private JTextField tf_Search;// 搜索文本域
	private JLabel lb_Search;// 搜索按钮
	private JLabel lb_SearchTips;// 搜索提示
	private JLabel lb_Recharge;// 充值按钮
	private JLabel lb_WritersCenter;// 作家中心按钮
	private JLabel lb_center_loginMail;// 中部登录邮件图像
	private JLabel lb_center_loginHeadPicture;// 中部登录头像

	private JPanel pl_north_south;// 上部固定面板下部
	private JLabel lb_FirstPage;// 首页按钮
	private JLabel lb_FirstPagePart;// 首页按钮隔开线
	private JLabel lb_StackRoom;// 书库按钮
	private JLabel lb_StackRoomPart;// 书库按钮隔开线
	private JLabel lb_Ranking;// 排行按钮
	private JLabel lb_RankingPart;// 排行按钮隔开线
	private JLabel lb_IpSpecialArea;// IP专区按钮
	private JLabel lb_IpSpecialAreaPart;// IP专区按钮隔开线
	private JLabel lb_WriterWelfare;// 作家福利按钮
	private JLabel lb_WriterWelfarePart;// 作家福利按钮隔开线
	private JLabel lb_AnnounceInformation;// 公告资讯按钮
	private JLabel lb_AnnounceInformationPart;// 公告资讯按钮隔开线
	private JLabel lb_GirlSpecialArea;// 女生专区按钮
	private JLabel lb_GirlSpecialAreaPart;// 女生专区按钮隔开线
	private JLabel lb_MyBookShelf;// 我的书架按钮

	/*
	 * 中部面板以及中部切换面板：首页、排行、登录、我的书库、注册
	 */
	private JPanel pl_center;// 中部总面板
	private JPanel pl_centerleft;// 中部切换面板左面板
	private JPanel pl_centerright;// 中部切换面板右面板
	/*
	 * 注册面板
	 */
	private JPanel pl_register;// 注册面板
	private JPanel pl_register_north;// 注册上面板
	private JPanel pl_register_north_left;// 注册上面板左
	private JLabel lb_register_userregister;// 用户注册文字
	private JPanel pl_register_north_right;// 注册上面板右
	private JLabel lb_register_tips;// 已有书海账号文字
	private JLabel lb_register_login;// 登录按钮

	private JPanel pl_register_center;// 登录中面板
	private JPanel pl_register_center_left;// 登录中面板左部
	private JLabel lb_register_phonenumber;// 手机号
	private JTextField ta_register_phonenumber;// 手机号输入框
	private JLabel lb_register_phonenumberErrorTip;// 手机号输入错误提示
	private JLabel lb_register_verificode;// 验证码
	private JTextField ta_register_verificode;// 验证码输入框
	private JLabel lb_register_verificodeErrorTip;// 验证码输入错误提示
	private JLabel lb_register_VerificodePicture;// 验证码图片
	private JLabel lb_register_VerificodePictureTxt;// 验证码更换文字
	private CodeMaker codeMaker = new CodeMaker();//验证码图片生成工具
	private static String register_validCode;//验证码
	private JLabel lb_register_mailbox;// 邮箱
	private JTextField ta_register_mailbox;// 邮箱输入框
	private JLabel  lb_register_mailboxErrorTip;// 邮箱输入错误提示
	private JLabel lb_register_nickname;// 昵称
	private JTextField ta_register_nickname;// 昵称输入框
	private JLabel  lb_register_nicknameErrorTip;// 昵称输入错误提示
	private JLabel lb_register_password;// 密码
	private JPasswordField pf_register_password;// 密码输入框 
	private JLabel  lb_register_passwordErrorTip;//  密码输入错误提示
	private JLabel lb_register_confirmpassword;// 确认密码
	private JPasswordField pf_register_confirmpassword;// 确认密码输入框 
	private JLabel  lb_register_confirmpasswordErrorTip;//确认密码输入错误提示
	private JCheckBox cb_AgreeAgreement;// 我已阅读并同意协议单选框
	private JLabel lb_AgreeAgreement;// 我已阅读并同意协议文字
	private JLabel  lb_AgreeAgreementTip;// 协议未勾选
	private JLabel lb_register_register;// 立即注册账号按钮

	private JPanel pl_register_center_right;// 登录中面板右部
	private JLabel lb_register_center_right_txt;// 登录中面右部文字
	
	private JPanel pl_register_south;// 登录下面板
	private JLabel lb_register_south_youqinglianjie;// 登录下面板友情链接
	
	private static final long serialVersionUID = 1L;
	private static BaseDao baseDao=new BaseDao();//数据库调用方法
	private static List<String> RegisterUserNames=new ArrayList<String>();//储存所有的Username
	private static List<String> RegisterUserMails=new ArrayList<String>();//储存所有的Mails
	private static List<String> RegisterUserPhones=new ArrayList<String>();//储存所有的Phones
	private Map<String, Boolean> RegisterIsAllPass=new HashMap<String, Boolean>();//存放所有内容是否通过
	private Map<String, String> RegisterInformation=new HashMap<String, String>();//存放注册的所有信息。
	//获取磁盘的最后一个磁盘：登录验证码
		private static String loginSavePath = "";
		static {
			File[] roots = File.listRoots();
			loginSavePath = roots[roots.length-1].getPath();
			File file = new File(loginSavePath+="/validCodesImgs/");
			//判断文件夹是否存在，不存在则创建
			if (file == null || !file.exists()) {
				file.mkdirs();
			}
		}
		//获取磁盘的最后一个磁盘：注册验证码
				private static String registerSavePath = "";
				static {
					File[] roots = File.listRoots();
					registerSavePath = roots[roots.length-1].getPath();
					File file = new File(registerSavePath+="/validCodesImgs/");
					//判断文件夹是否存在，不存在则创建
					if (file == null || !file.exists()) {
						file.mkdirs();
					}
				}
	public Register_Jpanel() {
		// 设置总布局
		JFrame jf = new JFrame("书海小说网");
		jf.setLayout(new BorderLayout());
		jf.setIconImage(Toolkit.getDefaultToolkit().createImage(Register_Jpanel.class.getResource("./LXFimg/主题.jpg")));

		// 获取屏幕分辨率
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
		int ScreenWidth = dimension.width;
		int ScreenHeight = dimension.height;

		// 界面总面板
		pl_ALL = new JPanel();
		pl_ALL.setLayout(new BorderLayout());
		pl_ALL.setPreferredSize(new Dimension(ScreenWidth, (int)(ScreenHeight*1.2)));

		// 滑动总面板
		sp_center = new JScrollPane();
		sp_center.getViewport().add(pl_ALL);
		//设置滚动条滑动速度
		sp_center.getVerticalScrollBar().setUnitIncrement(30);
		jf.add(sp_center);

		// 上部总面板
		pl_north = new JPanel();
		pl_north.setLayout(new BorderLayout());
		pl_north.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 0.2)));
		pl_north.setBackground(Color.white);
		pl_ALL.add(BorderLayout.NORTH, pl_north);

		// 上部面板上部
		pl_north_north = new JPanel();
		pl_north_north.setLayout(null);
		pl_north_north.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 0.2 * 0.2)));
		pl_north_north.setBackground(new Color(189, 183, 107));
		pl_north.add(BorderLayout.NORTH, pl_north_north);
		Font font = new Font("微软雅黑", Font.PLAIN, 12);

		// 书海女神网按钮
		lb_BookSeaGirlNet = new JLabel("书海女生网");
		lb_BookSeaGirlNet.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_BookSeaGirlNet.setFont(font);
		lb_BookSeaGirlNet.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_BookSeaGirlNet.setForeground(Color.black);
		lb_BookSeaGirlNet.setBounds((int) (ScreenWidth * 0.125), (int) (ScreenHeight * 0.2 * 0.2 * 0), 60, 30);
		pl_north_north.add(lb_BookSeaGirlNet);

		// 书海女神网按钮隔开线
		lb_BookSeaGirlNetPart = new JLabel("|");
		lb_BookSeaGirlNetPart.setFont(font);
		lb_BookSeaGirlNetPart.setForeground(Color.black);
		lb_BookSeaGirlNetPart.setBounds((int) (ScreenWidth * 0.175), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10, 30);
		pl_north_north.add(lb_BookSeaGirlNetPart);

		// 书海文学网按钮
		lb_BookSeaLiteratureNet = new JLabel("书海文学网");
		lb_BookSeaLiteratureNet.setFont(font);
		lb_BookSeaLiteratureNet.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_BookSeaLiteratureNet.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_BookSeaLiteratureNet.setForeground(Color.black);
		lb_BookSeaLiteratureNet.setBounds((int) (ScreenWidth * 0.185), (int) (ScreenHeight * 0.2 * 0.2 * 0), 60, 30);
		pl_north_north.add(lb_BookSeaLiteratureNet);

		// 书海女神网按钮隔开线
		lb_BookSeaLiteratureNetPart = new JLabel("|");
		lb_BookSeaLiteratureNetPart.setFont(font);
		lb_BookSeaLiteratureNetPart.setForeground(Color.black);
		lb_BookSeaLiteratureNetPart.setBounds((int) (ScreenWidth * 0.235), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10,
				30);
		pl_north_north.add(lb_BookSeaLiteratureNetPart);

		// 书海动漫网按钮
		lb_BookSeaComicNet = new JLabel("书海动漫网");
		lb_BookSeaComicNet.setFont(font);
		lb_BookSeaComicNet.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_BookSeaComicNet.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_BookSeaComicNet.setForeground(Color.black);
		lb_BookSeaComicNet.setBounds((int) (ScreenWidth * 0.245), (int) (ScreenHeight * 0.2 * 0.2 * 0), 60, 30);
		pl_north_north.add(lb_BookSeaComicNet);

		// 注册按钮
		lb_register = new JLabel("注册");
		lb_register.setFont(font);
		lb_register.setForeground(Color.black);
		lb_register.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new Register_Jpanel();
				jf.dispose();
			}
		});
		lb_register.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_register.setBounds((int) (ScreenWidth * 0.72), (int) (ScreenHeight * 0.2 * 0.2 * 0), 30, 30);
		pl_north_north.add(lb_register);

		// 注册按钮隔开线
		lb_registerPart = new JLabel("|");
		lb_registerPart.setFont(font);
		lb_registerPart.setForeground(Color.black);
		lb_registerPart.setBounds((int) (ScreenWidth * 0.745), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10, 30);
		pl_north_north.add(lb_registerPart);

		// 登录按钮
		lb_north_login = new JLabel("登录");
		lb_north_login.setFont(font);
		lb_north_login.setForeground(Color.red);
		lb_north_login.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new Login_Panel();
				jf.dispose();
			}
		});
		lb_north_login.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_north_login.setBounds((int) (ScreenWidth * 0.755), (int) (ScreenHeight * 0.2 * 0.2 * 0), 30, 30);
		pl_north_north.add(lb_north_login);

		// 登录按钮隔开线
		lb_north_loginPart = new JLabel("|");
		lb_north_loginPart.setFont(font);
		lb_north_loginPart.setForeground(Color.black);
		lb_north_loginPart.setBounds((int) (ScreenWidth * 0.78), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10, 30);
		pl_north_north.add(lb_north_loginPart);

		// 帮助按钮
		lb_help = new JLabel("帮助");
		lb_help.setFont(font);
		lb_help.setForeground(Color.black);
		lb_help.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_help.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_help.setBounds((int) (ScreenWidth * 0.79), (int) (ScreenHeight * 0.2 * 0.2 * 0), 30, 30);
		pl_north_north.add(lb_help);

		// 帮助按钮隔开线
		lb_helpPart = new JLabel("|");
		lb_helpPart.setFont(font);
		lb_helpPart.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_helpPart.setForeground(Color.black);
		lb_helpPart.setBounds((int) (ScreenWidth * 0.815), (int) (ScreenHeight * 0.2 * 0.2 * 0), 10, 30);
		pl_north_north.add(lb_helpPart);

		// 客户端按钮
		lb_Client = new JLabel("客户端");
		lb_Client.setFont(font);
		lb_Client.setForeground(Color.black);
		lb_Client.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_Client.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_Client.setBounds((int) (ScreenWidth * 0.825), (int) (ScreenHeight * 0.2 * 0.2 * 0), 40, 30);
		pl_north_north.add(lb_Client);

		// 上部面板中部
		pl_north_center = new JPanel();
		pl_north_center.setLayout(null);
		pl_north_center.setBackground(Color.white);
		pl_north.add(BorderLayout.CENTER, pl_north_center);

		// 上部面板中部书海图片
		lb_BooksSea = new JLabel();
		lb_BooksSea.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/书海标题.png")));
		lb_BooksSea.setBounds((int) (ScreenWidth * 0.105), (int) (ScreenHeight * 0.2 * 0.6 * 0.2), 150, 60);
		pl_north_center.add(lb_BooksSea);

		// 上部面板热搜图片
		lb_HotSearch = new JLabel();
		lb_HotSearch.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/首页热搜图片.png")));
		lb_HotSearch.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.2), 200, 20);
		pl_north_center.add(lb_HotSearch);

		// 搜索文本框
		tf_Search = new JTextField();
		tf_Search.setFont(font);
		tf_Search.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.44), 225, 30);
		pl_north_center.add(tf_Search);

		// 上部面板输入提示图片
		lb_SearchTips = new JLabel();
		lb_SearchTips.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/输入提示标签.png")));
		lb_SearchTips.setBounds((int) (ScreenWidth * 0.375), (int) (ScreenHeight * 0.2 * 0.6 * 0.7), 225, 30);
		pl_north_center.add(lb_SearchTips);

		// 上部面板搜索按钮图片
		lb_Search = new JLabel();
		lb_Search.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/搜索按钮.png")));
		lb_Search.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_Search.setBounds((int) (ScreenWidth * 0.54), (int) (ScreenHeight * 0.2 * 0.6 * 0.44), 50, 30);
		pl_north_center.add(lb_Search);

		// 上部面板充值按钮
		lb_Recharge = new JLabel();
		lb_Recharge.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_Recharge.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/充值图片.png")));
		lb_Recharge.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_Recharge.setBounds((int) (ScreenWidth * 0.69), (int) (ScreenHeight * 0.2 * 0.6 * 0.2), 80, 25);
		pl_north_center.add(lb_Recharge);

		// 上部面板作家中心按钮
		lb_WritersCenter = new JLabel();
		lb_WritersCenter.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_WritersCenter.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_WritersCenter.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/作家中心图片.png")));
		lb_WritersCenter.setBounds((int) (ScreenWidth * 0.69), (int) (ScreenHeight * 0.2 * 0.6 * 0.5), 80, 25);
		pl_north_center.add(lb_WritersCenter);

		// 上部面板邮件图像登录按钮
		lb_center_loginMail = new JLabel();
		lb_center_loginMail.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_center_loginMail.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new Login_Panel();
				jf.dispose();
			}
		});
		lb_center_loginMail.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/邮箱图片登录图片.png")));
		lb_center_loginMail.setBounds((int) (ScreenWidth * 0.77), (int) (ScreenHeight * 0.2 * 0.6 * 0.4), 25, 20);
		pl_north_center.add(lb_center_loginMail);

		// 上部面板登录头像图片
		lb_center_loginHeadPicture = new JLabel();
		lb_center_loginHeadPicture.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_center_loginHeadPicture.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new Login_Panel();
				jf.dispose();
			}
		});
		lb_center_loginHeadPicture.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/登录注册按钮.png")));
		lb_center_loginHeadPicture.setBounds((int) (ScreenWidth * 0.81), (int) (ScreenHeight * 0.2 * 0.6 * 0.3), 50,
				40);
		pl_north_center.add(lb_center_loginHeadPicture);

		// 上部面板下部
		pl_north_south = new JPanel();
		pl_north_south.setLayout(null);
		pl_north_south.setBackground(new Color(178, 34, 34));
		pl_north_south.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 0.2 * 0.2)));
		pl_north.add(BorderLayout.SOUTH, pl_north_south);

		// 标题文字格式
		font = new Font("微软雅黑", Font.PLAIN, 15);
		// 首页按钮
		lb_FirstPage = new JLabel("首页");
		lb_FirstPage.setFont(font);
		lb_FirstPage.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_FirstPage.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new FirstPage_Jpanel(null,false);
				jf.dispose();
			}
		});
		lb_FirstPage.setForeground(Color.white);
		lb_FirstPage.setBounds((int) (ScreenWidth * 0.16), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 30, 30);
		pl_north_south.add(lb_FirstPage);

		// 首页隔开按钮
		lb_FirstPagePart = new JLabel("|");
		lb_FirstPagePart.setFont(font);
		lb_FirstPagePart.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_FirstPagePart.setForeground(Color.white);
		lb_FirstPagePart.setBounds((int) (ScreenWidth * 0.21), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_FirstPagePart);

		// 书库按钮
		lb_StackRoom = new JLabel("书库");
		lb_StackRoom.setFont(font);
		lb_StackRoom.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new StackRoom(null,false);
				jf.dispose();
			}
		});
		lb_StackRoom.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_StackRoom.setForeground(Color.white);
		lb_StackRoom.setBounds((int) (ScreenWidth * 0.24), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 30, 30);
		pl_north_south.add(lb_StackRoom);

		// 书库隔开标签
		lb_StackRoomPart = new JLabel("|");
		lb_StackRoomPart.setFont(font);
		lb_StackRoomPart.setForeground(Color.white);
		lb_StackRoomPart.setBounds((int) (ScreenWidth * 0.29), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_StackRoomPart);

		// 排行按钮
		lb_Ranking = new JLabel("排行");
		lb_Ranking.setFont(font);
		lb_Ranking.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new RankingFrame(null, false);
				jf.dispose();
			}
		});
		lb_Ranking.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_Ranking.setForeground(Color.white);
		lb_Ranking.setBounds((int) (ScreenWidth * 0.325), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 30, 30);
		pl_north_south.add(lb_Ranking);

		// 排行隔开标签
		lb_RankingPart = new JLabel("|");
		lb_RankingPart.setFont(font);
		lb_RankingPart.setForeground(Color.white);
		lb_RankingPart.setBounds((int) (ScreenWidth * 0.37), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_RankingPart);

		// IP专区按钮
		lb_IpSpecialArea = new JLabel("IP专区");
		lb_IpSpecialArea.setFont(font);
		lb_IpSpecialArea.setForeground(Color.white);
		lb_IpSpecialArea.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_IpSpecialArea.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_IpSpecialArea.setBounds((int) (ScreenWidth * 0.4), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 60, 30);
		pl_north_south.add(lb_IpSpecialArea);

		// IP专区按钮隔开线
		lb_IpSpecialAreaPart = new JLabel("|");
		lb_IpSpecialAreaPart.setFont(font);
		lb_IpSpecialAreaPart.setForeground(Color.white);
		lb_IpSpecialAreaPart.setBounds((int) (ScreenWidth * 0.455), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_IpSpecialAreaPart);

		// 作家福利按钮
		lb_WriterWelfare = new JLabel("作家福利");
		lb_WriterWelfare.setFont(font);
		lb_WriterWelfare.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_WriterWelfare.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			 new WelfareFrame();
			 jf.dispose();
			}
		});
		lb_WriterWelfare.setForeground(Color.white);
		lb_WriterWelfare.setBounds((int) (ScreenWidth * 0.485), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 60, 30);
		pl_north_south.add(lb_WriterWelfare);

		// 作家福利按钮隔开线
		lb_WriterWelfarePart = new JLabel("|");
		lb_WriterWelfarePart.setFont(font);
		lb_WriterWelfarePart.setForeground(Color.white);
		lb_WriterWelfarePart.setBounds((int) (ScreenWidth * 0.55), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_WriterWelfarePart);

		// 公告资讯按钮
		lb_AnnounceInformation = new JLabel("公告资讯");
		lb_AnnounceInformation.setFont(font);
		lb_AnnounceInformation.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			 new Notice(null,false);
			 jf.dispose();
			}
		});
		lb_AnnounceInformation.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_AnnounceInformation.setForeground(Color.white);
		lb_AnnounceInformation.setBounds((int) (ScreenWidth * 0.58), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 60, 30);
		pl_north_south.add(lb_AnnounceInformation);

		// 公告资讯按钮隔开线
		lb_AnnounceInformationPart = new JLabel("|");
		lb_AnnounceInformationPart.setFont(font);
		lb_AnnounceInformationPart.setForeground(Color.white);
		lb_AnnounceInformationPart.setBounds((int) (ScreenWidth * 0.645), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10,
				30);
		pl_north_south.add(lb_AnnounceInformationPart);

		// 女生专区按钮
		lb_GirlSpecialArea = new JLabel("女生专区");
		lb_GirlSpecialArea.setFont(font);
		lb_GirlSpecialArea.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			 JOptionPane.showMessageDialog(null, "该功能正在建设中");
			}
		});
		lb_GirlSpecialArea.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_GirlSpecialArea.setForeground(Color.white);
		lb_GirlSpecialArea.setBounds((int) (ScreenWidth * 0.675), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 60, 30);
		pl_north_south.add(lb_GirlSpecialArea);

		// 女生专区按钮隔开线
		lb_GirlSpecialAreaPart = new JLabel("|");
		lb_GirlSpecialAreaPart.setFont(font);
		lb_GirlSpecialAreaPart.setForeground(Color.white);
		lb_GirlSpecialAreaPart.setBounds((int) (ScreenWidth * 0.74), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 10, 30);
		pl_north_south.add(lb_GirlSpecialAreaPart);

		// 我的书架按钮
		lb_MyBookShelf = new JLabel("我的书架");
		lb_MyBookShelf.setFont(font);
		lb_MyBookShelf.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
			 JOptionPane.showMessageDialog(null, "请先登录！");
			 jf.dispose();
			}
		});
		lb_MyBookShelf.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_MyBookShelf.setForeground(Color.white);
		lb_MyBookShelf.setBounds((int) (ScreenWidth * 0.77), (int) (ScreenHeight * 0.2 * 0.2 * 0.05), 60, 30);
		pl_north_south.add(lb_MyBookShelf);
		/*
		 * ======================================中部切换面板=================================
		 * =======
		 */
		// 中部面板
		pl_center = new JPanel();
		pl_center.setLayout(new BorderLayout());
		pl_center.setBackground(Color.white);
		pl_ALL.add(BorderLayout.CENTER, pl_center);

		// 中部切换面板左面板
		pl_centerleft = new JPanel();
		pl_centerleft.setBackground(Color.white);
		pl_centerleft.setPreferredSize(new Dimension((int) (ScreenWidth * 0.125), 0));
		pl_center.add(BorderLayout.WEST, pl_centerleft);

		// 中部切换面板右面板
		pl_centerright = new JPanel();
		pl_centerright.setBackground(Color.white);
		pl_centerright.setPreferredSize(new Dimension((int) (ScreenWidth * 0.15), 0));
		pl_center.add(BorderLayout.EAST, pl_centerright);
		/*
		 * 中部切换面板中面板
		 */
/*=========================================================================================================================*/
		// 注册面板
		pl_register = new JPanel();
		pl_register.setBackground(Color.white);
		pl_register.setLayout(new BorderLayout());
		pl_register.setBorder(new LineBorder(Color.gray));
		pl_center.add(BorderLayout.CENTER,pl_register);
		// 转图第一页
		ImageIcon ScrollPicture = new ImageIcon(FirstPage_Jpanel.class.getResource("./LXFimg/首页转图第一页.jpg"));

		// 注册上面板
		pl_register_north = new JPanel();
		pl_register_north.setLayout(new BorderLayout());
		pl_register_north.setBorder(new LineBorder(Color.GRAY));
		pl_register_north.setPreferredSize(new Dimension(0, 30));
		pl_register_north.setBackground(Color.white);
		pl_register.add(BorderLayout.NORTH, pl_register_north);

		// 注册上面板左
		pl_register_north_left = new JPanel();
		pl_register_north_left.setLayout(null);
		pl_register_north_left.setBorder(new LineBorder(Color.GRAY));
		pl_register_north_left.setPreferredSize(new Dimension(ScrollPicture.getIconWidth(), 0));
		pl_register_north_left.setBackground(Color.white);
		pl_register_north.add(BorderLayout.WEST, pl_register_north_left);
		// 用户登录文字
		lb_register_userregister = new JLabel("用户登录");
		lb_register_userregister.setFont(new Font("楷体", Font.PLAIN, 15));
		lb_register_userregister.setForeground(Color.black);
		lb_register_userregister.setBounds(10, 0, 100, 30);
		pl_register_north_left.add(lb_register_userregister);

		// 注册上面板右
		pl_register_north_right = new JPanel();
		pl_register_north_right.setLayout(null);
		pl_register_north_right.setBorder(new LineBorder(Color.GRAY));
		pl_register_north_right.setBackground(Color.white);
		pl_register_north.add(BorderLayout.CENTER, pl_register_north_right);
		// 用户注册文字
		lb_register_tips = new JLabel("已有书海账号?");
		lb_register_tips.setFont(new Font("楷体", Font.PLAIN, 15));
		lb_register_tips.setForeground(Color.black);
		lb_register_tips.setBounds(10, 0, 100, 30);
		pl_register_north_right.add(lb_register_tips);
		// 登录按钮
		lb_register_login = new JLabel();
		lb_register_login.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_register_login.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				new Login_Panel();
				jf.dispose();
			}
		});
		lb_register_login.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/登录按钮2.png")));
		lb_register_login.setBounds(110, 0, 30, 30);
		pl_register_north_right.add(lb_register_login);

		// 注册中面板
		pl_register_center = new JPanel();
		pl_register_center.setLayout(new BorderLayout());
		pl_register_center.setBorder(new LineBorder(Color.GRAY));
		pl_register_center.setBackground(Color.white);
		pl_register.add(BorderLayout.CENTER, pl_register_center);

		//输入框内文字格式
		Font font2=new Font("微软雅黑", Font.PLAIN, 13);
		// 注册中面板左
		pl_register_center_left = new JPanel();
		pl_register_center_left.setLayout(null);
		pl_register_center_left.setBorder(new LineBorder(Color.GRAY));
		pl_register_center_left.setPreferredSize(new Dimension(ScrollPicture.getIconWidth(), 0));
		pl_register_center_left.setBackground(Color.white);
		pl_register_center.add(BorderLayout.WEST, pl_register_center_left);
		// 手机号文字
		lb_register_phonenumber = new JLabel("手机号:");
		lb_register_phonenumber.setFont(font);
		lb_register_phonenumber.setBounds((int)(ScrollPicture.getIconWidth()*0.1), 50, 50, 30);
		pl_register_center_left.add(lb_register_phonenumber);
		// 手机号文字输入框
		ta_register_phonenumber = new JTextField();
		ta_register_phonenumber.setBorder(new LineBorder(Color.black));
		ta_register_phonenumber.setFont(font2);
		ta_register_phonenumber.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 53, 200, 25);
		ta_register_phonenumber.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				//重新添加文本域
				ta_register_phonenumber.setFocusable(true);
				ta_register_phonenumber.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			//去掉文本域的光标
			ta_register_phonenumber.setFocusable(false);
			String phone = ta_register_phonenumber.getText();
			boolean flag = false;
			searchUserPhones();
			if (phone != null && !"".equals(phone)) {
				if (Pattern.matches("^1\\d{10}$", phone)) {
					for (int i = 0; i < RegisterUserPhones.size(); i++) {
						if (phone.equals(RegisterUserPhones.get(i))) {
							ta_register_phonenumber.setBorder(new LineBorder(Color.red));
							lb_register_phonenumberErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/改手机号已被注册.png")));
							break;
						}else {
							flag = true;
							ta_register_phonenumber.setBorder(new LineBorder(Color.black));
							lb_register_phonenumberErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板单个通过标签.png")));
						}
					}
				} else {
					ta_register_phonenumber.setBorder(new LineBorder(Color.red));
					lb_register_phonenumberErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板手机号格式错误.png")));
				}
			} else {
				ta_register_phonenumber.setBorder(new LineBorder(Color.red));
				lb_register_phonenumberErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板手机号未输入提示.png")));
			}
			RegisterIsAllPass.put("phone", flag);
			if(flag) {
				RegisterInformation.put("phone", phone);
			}
			}
		});
		pl_register_center_left.add(ta_register_phonenumber);
		// 手机号输入错误提示
		lb_register_phonenumberErrorTip= new JLabel();
		lb_register_phonenumberErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.48), 42, 120, 30);
		pl_register_center_left.add(lb_register_phonenumberErrorTip);

		// 验证码文字
		lb_register_verificode = new JLabel("验证码:");
		lb_register_verificode.setFont(font);
		lb_register_verificode.setBounds((int)(ScrollPicture.getIconWidth()*0.1), 90, 50, 30);
		pl_register_center_left.add(lb_register_verificode);
		
		// 验证码文字输入框
		ta_register_verificode = new JTextField();
		ta_register_verificode.setBorder(new LineBorder(Color.black));
		ta_register_verificode.setFont(font2);
		ta_register_verificode.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 93, 200, 25);
		ta_register_verificode.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
			ta_register_verificode.setFocusable(true);
			ta_register_verificode.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			ta_register_verificode.setFocusable(false);
				String verifCode = ta_register_verificode.getText();
				boolean flag = false;
				if (verifCode!=null&&!"".equals(verifCode)) {
						ta_register_verificode.setBorder(new LineBorder(Color.black));
						lb_register_verificodeErrorTip.setIcon(null);
						if (verifCode.equalsIgnoreCase(register_validCode)) {
							flag = true;
						}
				} else {
					ta_register_verificode.setBorder(new LineBorder(Color.red));
					lb_register_verificodeErrorTip
					.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板验证码未输入提示.png")));
				}
				RegisterIsAllPass.put("verifCode", flag);
				
			}
		});
		pl_register_center_left.add(ta_register_verificode);
		
		// 验证码图片
		lb_register_VerificodePicture = new JLabel();
		createRegisterValidCodes();
		lb_register_VerificodePicture.setBounds((int) (ScrollPicture.getIconWidth() * 0.19) + 205, 90, 100, 30);
		lb_register_VerificodePicture.setCursor(new Cursor(Cursor.HAND_CURSOR));
		pl_register_center_left.add(lb_register_VerificodePicture);

		// 验证码切换
		lb_register_VerificodePictureTxt = new JLabel("换一张");
		lb_register_VerificodePictureTxt.setFont(new Font("微软雅黑", Font.PLAIN, 10));
		lb_register_VerificodePictureTxt.setBounds((int) (ScrollPicture.getIconWidth() * 0.19) + 308, 100, 30, 15);
		lb_register_VerificodePictureTxt.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_register_VerificodePictureTxt.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				createRegisterValidCodes();
			}
		});
		pl_register_center_left.add(lb_register_VerificodePictureTxt);
		// 验证码输入错误提示
		lb_register_verificodeErrorTip = new JLabel();
		lb_register_verificodeErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.63), 80, 120, 30);
		pl_register_center_left.add(lb_register_verificodeErrorTip);

		// 邮箱文字
		lb_register_mailbox = new JLabel("邮箱:");
		lb_register_mailbox.setFont(font);
		lb_register_mailbox.setBounds((int)(ScrollPicture.getIconWidth()*0.12), 130, 50, 30);
		pl_register_center_left.add(lb_register_mailbox);
		// 邮箱文字输入框
		ta_register_mailbox = new JTextField();
		ta_register_mailbox.setBorder(new LineBorder(Color.black));
		ta_register_mailbox.setFont(font2);
		ta_register_mailbox.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 133, 200, 25);
		ta_register_mailbox.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				ta_register_mailbox.setFocusable(true);
				ta_register_mailbox.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			ta_register_mailbox.setFocusable(false);
			searchUserMails();
			String Mail=ta_register_mailbox.getText();//获取邮件输入框中的内容
			boolean flag = false;
			if (Mail != null && !"".equals(Mail)) {
				if (Mail.length() >= 6 && Mail.length() <= 18) {
						if (Pattern.matches("[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?", Mail)) {
							for (int i = 0; i < RegisterUserMails.size(); i++) {
								if (Mail.equalsIgnoreCase(RegisterUserMails.get(i))) {
									ta_register_mailbox.setBorder(new LineBorder(Color.red));
									lb_register_mailboxErrorTip
									.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/该邮箱已被注册.png")));
									break;
								}else {
									ta_register_mailbox.setBorder(new LineBorder(Color.black));
									lb_register_mailboxErrorTip
									.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板单个通过标签.png")));
									flag = true;
								}
							}
						} else {
							ta_register_mailbox.setBorder(new LineBorder(Color.red));
							lb_register_mailboxErrorTip
							.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板邮箱格式不正确.png")));
						}
				} else {
					ta_register_mailbox.setBorder(new LineBorder(Color.red));
					lb_register_mailboxErrorTip
					.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板邮箱格式不正确.png")));
				}
			} else {
				ta_register_mailbox.setBorder(new LineBorder(Color.red));
				lb_register_mailboxErrorTip
				.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板邮箱未输入提示.png")));
			}
			//验证完成后，存储验证结果
			RegisterIsAllPass.put("email", flag);
			if (flag) {
				RegisterInformation.put("email", Mail);
			}
			}
		});
		pl_register_center_left.add(ta_register_mailbox);
		
		
		// 邮箱输入错误提示
		lb_register_mailboxErrorTip = new JLabel();
		lb_register_mailboxErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.48), 125, 120, 30);
		pl_register_center_left.add(lb_register_mailboxErrorTip);

		// 昵称文字
		lb_register_nickname = new JLabel("昵称:");
		lb_register_nickname.setFont(font);
		lb_register_nickname.setBounds((int)(ScrollPicture.getIconWidth()*0.12), 170, 50, 30);
		pl_register_center_left.add(lb_register_nickname);
		// 昵称文字输入框
		ta_register_nickname = new JTextField();
		ta_register_nickname.setBorder(new LineBorder(Color.black));
		ta_register_nickname.setFont(font2);
		ta_register_nickname.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 173, 200, 25);
		ta_register_nickname.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				ta_register_nickname.setFocusable(true);
				ta_register_nickname.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			ta_register_nickname.setFocusable(false);
			Boolean flag=false;
			searchUserNames();
			String nickname=ta_register_nickname.getText();
			if (nickname==null||nickname.equals("")) {
				ta_register_nickname.setBorder(new LineBorder(Color.red));
				lb_register_nicknameErrorTip
				.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板昵称未输入提示.png")));
			}else {
				for (int i = 0; i < RegisterUserNames.size(); i++) {
					if (nickname.equals(RegisterUserNames.get(i))) {
						ta_register_nickname.setBorder(new LineBorder(Color.red));
						lb_register_nicknameErrorTip
						.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/该用户已被注册.png")));
						break;
					}else {
						ta_register_nickname.setBorder(new LineBorder(Color.black));
						lb_register_nicknameErrorTip
						.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板单个通过标签.png")));
						flag=true;
					}
				}
			}
			RegisterIsAllPass.put("nickname", flag);
			if (flag) {
				RegisterInformation.put("nickname", nickname);
			}
			}
		});
		pl_register_center_left.add(ta_register_nickname);
		// 昵称输入错误提示
		lb_register_nicknameErrorTip = new JLabel();
		lb_register_nicknameErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.48), 165, 120, 30);
		pl_register_center_left.add(lb_register_nicknameErrorTip);

		// 密码文字
		lb_register_password = new JLabel("密码:");
		lb_register_password.setFont(font);
		lb_register_password.setBounds((int)(ScrollPicture.getIconWidth()*0.12), 210, 50, 30);
		pl_register_center_left.add(lb_register_password);
		// 密码文字输入框
		pf_register_password = new JPasswordField();
		pf_register_password.setBorder(new LineBorder(Color.black));
		pf_register_password.setFont(font2);
		pf_register_password.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 213, 200, 25);
		pf_register_password.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				pf_register_password.setFocusable(true);
				pf_register_password.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			pf_register_password.setFocusable(false);
			Boolean flag=false;
			 String password=pf_register_password.getText();
			if (password==null||password.equals("")) {
				pf_register_password.setBorder(new LineBorder(Color.red));
				lb_register_passwordErrorTip
				.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板密码未输入提示.png")));
			}else {
				pf_register_password.setBorder(new LineBorder(Color.black));
				lb_register_passwordErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板单个通过标签.png")));
			    flag=true;
			}
			RegisterIsAllPass.put("password", flag);
			}
		});
		pl_register_center_left.add(pf_register_password);
		// 密码输入错误提示
		lb_register_passwordErrorTip = new JLabel();
		lb_register_passwordErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.48), 205, 120, 30);
		pl_register_center_left.add(lb_register_passwordErrorTip);
		
		
		// 确认密码文字
		lb_register_confirmpassword = new JLabel("确认密码:");
		lb_register_confirmpassword.setFont(font);
		lb_register_confirmpassword.setBounds((int)(ScrollPicture.getIconWidth()*0.08), 250, 100, 30);
		pl_register_center_left.add(lb_register_confirmpassword);
		// 确认密码文字输入框
		pf_register_confirmpassword = new JPasswordField();
		pf_register_confirmpassword.setBorder(new LineBorder(Color.black));
		pf_register_confirmpassword.setFont(font2);
		pf_register_confirmpassword.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 253, 200, 25);
		pf_register_confirmpassword.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseEntered(MouseEvent e) {
				pf_register_confirmpassword.setFocusable(true);
				pf_register_confirmpassword.setBorder(new LineBorder(Color.blue));
			}
			@Override
			public void mouseExited(MouseEvent e) {
			pf_register_confirmpassword.setFocusable(false);
			String confirmpassword=pf_register_confirmpassword.getText();
			Boolean flag=false;
			if (confirmpassword==null||confirmpassword.equals("")) {
				pf_register_confirmpassword.setBorder(new LineBorder(Color.red));
				lb_register_confirmpasswordErrorTip
				.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板确认密码未输入提示.png")));
			}else {
				if (!confirmpassword.equals(pf_register_password.getText())) {
					pf_register_confirmpassword.setBorder(new LineBorder(Color.red));
					lb_register_confirmpasswordErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板密码与确认密码不一致.png")));
				}else {
					pf_register_confirmpassword.setBorder(new LineBorder(Color.black));
					lb_register_confirmpasswordErrorTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板单个通过标签.png")));
					flag=true;
				}
			}
			RegisterIsAllPass.put("confirmpassword", flag);
			if (flag) {
				RegisterInformation.put("password", confirmpassword);
			}
			}
		});
		pl_register_center_left.add(pf_register_confirmpassword);
		// 确认密码输入错误提示
		lb_register_confirmpasswordErrorTip = new JLabel();
		lb_register_confirmpasswordErrorTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.48), 245, 140, 30);
		pl_register_center_left.add(lb_register_confirmpasswordErrorTip);
		
		// 同意协议单选框
		cb_AgreeAgreement = new JCheckBox();
		cb_AgreeAgreement.setBorder(new LineBorder(Color.black));
		cb_AgreeAgreement.setBackground(Color.white);
		cb_AgreeAgreement.setCursor(new Cursor(Cursor.HAND_CURSOR));
		cb_AgreeAgreement.setBounds((int)(ScrollPicture.getIconWidth()*0.18), 293, 25, 25);
		cb_AgreeAgreement.addMouseListener(new MouseAdapter() {
		    @Override
		    public void mouseExited(MouseEvent e) {
		    	Boolean flag=false;
		    	if (cb_AgreeAgreement.isSelected()) {
					lb_AgreeAgreementTip.setIcon(null);
					flag=true;
				} else {
					lb_AgreeAgreementTip.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板未勾选协议.png")));
				}
		    	RegisterIsAllPass.put("AgreeAgreementTip", flag);
		    }
		});
		pl_register_center_left.add(cb_AgreeAgreement);
		// 记住账号文字
		lb_AgreeAgreement = new JLabel("我已阅读并同意《用户协议》");
		lb_AgreeAgreement.setFont(font);
		lb_AgreeAgreement.setBounds((int)(ScrollPicture.getIconWidth()*0.22), 293, 200, 25);
		pl_register_center_left.add(lb_AgreeAgreement);
		
		// 同意协议单选框未勾选提示
		lb_AgreeAgreementTip= new JLabel();
		lb_AgreeAgreementTip.setBounds((int) (ScrollPicture.getIconWidth() * 0.498) , 293, 200, 25);
		pl_register_center_left.add(lb_AgreeAgreementTip);
				
		// 立即注册按钮
		lb_register_register = new JLabel();
		lb_register_register.setCursor(new Cursor(Cursor.HAND_CURSOR));
		lb_register_register.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/立即注册按钮.png")));
		lb_register_register.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if (RegisterIsAllPass.get("phone")) {
					if (RegisterIsAllPass.get("verifCode")) {
						if (RegisterIsAllPass.get("email")) {
							if (RegisterIsAllPass.get("nickname")) {
								if (RegisterIsAllPass.get("password")) {
									if (RegisterIsAllPass.get("confirmpassword")) {
										if (RegisterIsAllPass.get("AgreeAgreementTip")) {
											Object params[]= {RegisterInformation.get("phone"),RegisterInformation.get("email"),RegisterInformation.get("nickname"),RegisterInformation.get("nickname"),RegisterInformation.get("password")};
											SaveUserInformation(params);
											JOptionPane.showMessageDialog(null, "注册成功！请返回登录");
											ta_register_mailbox.setText("");
											lb_register_mailboxErrorTip.setIcon(null);
											ta_register_nickname.setText("");
											lb_register_nicknameErrorTip.setIcon(null);
											ta_register_phonenumber.setText("");
											lb_register_phonenumberErrorTip.setIcon(null);
											ta_register_verificode.setText("");
											lb_register_verificodeErrorTip.setIcon(null);
											pf_register_confirmpassword.setText("");
											lb_register_confirmpasswordErrorTip.setIcon(null);
											pf_register_password.setText("");
											lb_register_passwordErrorTip.setIcon(null);
											RegisterIsAllPass.clear();
										}else {
											JOptionPane.showMessageDialog(null, "协议框未勾选！");
										}
									}else {
										JOptionPane.showMessageDialog(null, "密码填写不一致！");
									}
								}else {
									JOptionPane.showMessageDialog(null, "密码填写错误！");
								}
							}else {
								JOptionPane.showMessageDialog(null, "用户名填写错误！");
							}
						}else {
							JOptionPane.showMessageDialog(null, "邮箱填写错误！");
						}
					}else {
						JOptionPane.showMessageDialog(null, "验证码填写错误！");
					}
				}else {
					JOptionPane.showMessageDialog(null, "手机号填写错误！");
				}
			}
		});
		lb_register_register.setBounds((int)(ScrollPicture.getIconWidth()*0.19), 315, 150, 50);
		pl_register_center_left.add(lb_register_register);

		// 登录下面板右
		pl_register_center_right = new JPanel();
		pl_register_center_right.setLayout(null);
		pl_register_center_right.setBorder(new LineBorder(Color.GRAY));
		pl_register_center_right.setBackground(Color.white);
		pl_register_center.add(BorderLayout.CENTER, pl_register_center_right);

		// 登录下面板右面板文字
		lb_register_center_right_txt = new JLabel();
		lb_register_center_right_txt.setIcon(new ImageIcon(Register_Jpanel.class.getResource("./LXFimg/注册面板右侧文字.png")));
		lb_register_center_right_txt.setBounds(5, 0, 300, 300);
		pl_register_center_right.add(lb_register_center_right_txt);
		
		// 登录下面板
		pl_register_south = new JPanel();
		pl_register_south.setLayout(null);
		pl_register_south.setPreferredSize(new Dimension(0, (int) (ScreenHeight * 1.2 * 0.8 * 0.34)));
		pl_register_south.setBackground(Color.white);
		pl_register.add(BorderLayout.SOUTH, pl_register_south);

		// 登录下面板
		lb_register_south_youqinglianjie = new JLabel();
		lb_register_south_youqinglianjie.setIcon(new ImageIcon(Login_Panel.class.getResource("./LXFimg/首页友情链接.png")));
		lb_register_south_youqinglianjie.setBounds(0, 0, 988, 234);
		pl_register_south.add(lb_register_south_youqinglianjie);

		jf.setSize(ScreenWidth, ScreenHeight);// 设置大小
		jf.setVisible(true);// 设置可见
		jf.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);// 设置可关闭
		jf.setLocationRelativeTo(null);// 居中
	}
	public void createRegisterValidCodes() {
		try {
			//String savePath = URLDecoder.decode(RegFrame.class.getResource("/").getPath(), "utf-8")+"com/zking/reg/validCodeImgs/";
			//生成一张新的验证码图片
			long currTime = System.currentTimeMillis();
			codeMaker.createValidCode(registerSavePath+"/验证码图片"+currTime+".png");//验证码图片"+currTime+".png"
			lb_register_VerificodePicture.setIcon(new ImageIcon(registerSavePath+"/验证码图片"+currTime+".png"));
			//返回真实的验证码
			register_validCode= codeMaker.getValidCode();
		} catch (UnsupportedEncodingException e1) {
			e1.printStackTrace();
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
	//查询所有的用户名
	public static void searchUserNames(){
		String sql="select * from  user";
		try {
			RegisterUserNames=baseDao.ColumnListHandler(String.class, sql, "username");
		} catch (SQLException e) {
			e.printStackTrace();
		}finally {
			try {
				baseDao.CloseConnection();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
	//查询所有的邮箱
		public static void searchUserMails(){
			String sql="select * from  user";
			try {
				RegisterUserMails=baseDao.ColumnListHandler(String.class, sql, "email");
			} catch (SQLException e) {
				e.printStackTrace();
			}finally {
				try {
					baseDao.CloseConnection();
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
		}
		//查询所有的电话号码
				public static void searchUserPhones(){
					String sql="select * from  user";
					try {
						RegisterUserPhones=baseDao.ColumnListHandler(String.class, sql, "phone");
					} catch (SQLException e) {
						e.printStackTrace();
					}finally {
						try {
							baseDao.CloseConnection();
						} catch (SQLException e) {
							e.printStackTrace();
						}
					}
				}
				//查询所有的电话号码
				public static void SaveUserInformation(Object[] params){
					String sql="INSERT INTO USER(phone,email,username,nickname,PASSWORD) VALUES (?,?,?,?,?)";
					try {
						baseDao.update(sql, params);
					} catch (SQLException e) {
						e.printStackTrace();
					}finally {
						try {
							baseDao.CloseConnection();
						} catch (SQLException e) {
							e.printStackTrace();
						}
					}
				}

	public static void main(String[] args) {
	//System.out.println("测试！");
		new Register_Jpanel();
		// randomImage();
	}
}
